package cn.tedu.base.utils;


public class UserContext {
    //定义一个ThreadLocal用来存储userInfo
    static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    //保存当前登录用户信息到ThreadLocal
    public static void setUserInfo(String headUserInfo){
        threadLocal.set(headUserInfo);
    }

    //获取当前登录用户信息
    public  static String getUserInfo(){
        return threadLocal.get();
    }

    //移除当前登录用户信息
    public static void removeUserInfo(){
        threadLocal.remove();
    }



}
